﻿@inherits Vowei.Web.G18nWebViewPage<IEnumerable<Vowei.Core.Models.Task>>
@using Vowei.Web.Helpers
@using System.Web.Mvc.Html 
@using System.IO;
@using Vowei.Data.Models;
@using Vowei.Core.Models;

@{
    Project project = null;
    if (ViewData.ContainsKey("Project"))
    {
        project = ViewData["Project"] as Project;
        ViewBag.Title = string.Format(T("项目[{0}]的任务列表"), project.Title);
    }
    else
    {
        ViewBag.Title = T("任务列表");
    }
}

<table id="@Vowei.Web.Models.WebConstants.TicketsTableId">
    <tr>
        <th>
            @T(t => t.First().Title)
        </th>
        <th>
            @T(t => t.First().StartDate)
        </th>
        <th>
            @T(t => t.First().DueDate)
        </th>
        <th>
            @T(t => t.First().AssignedTo)
        </th>
        <th class="row_pk">@T(t => t.First().ID)</th>
        <th class="row_pk">@T("类型")</th>
        <th class="row_pk">@T(t => t.First().BelongsToMilestone)</th>
    </tr>
		
    @foreach (var task in Model)
    {
    <tr>
        <td>
            <a href="/Task/Details/@task.ID">@task.Title</a>
        </td>
        <td>
            @task.StartDate
        </td>
        <td>
            @task.DueDate
        </td>
        <td>
            @task.AssignedTo
        </td>
        <td class="row_pk">@task.ID</td>
        <td class="row_pk">
            @T("任务")
        </td>
        <td class="row_pk">@task.BelongsToMilestoneId</td>
    </tr>
    }
</table>

@if (ViewData.ContainsKey("Project"))
{
    <p>
        @Html.ActionLink(T("创建新任务"), "CreateIn", new { project = project.ID })
    </p>
}
    | <a href="/Ticket/ExportToExcel/?title=@Server.UrlEncode(ViewBag.Title)">@T("导出到Excel")</a>